home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol A-4 / (Vol A-4) Vol. A4.iso / Games / the-kitchen-of-doom.swf / scripts / frame_21 / DoAction.as
Text File  |  2008-03-14  |  4KB  |  143 lines

  1. function mute()
  2. {
  3.    _global.masterVolume.setVolume(0);
  4. }
  5. function unMute()
  6. {
  7.    _global.masterVolume.setVolume(restoreVolume);
  8. }
  9. function toggleButtons()
  10. {
  11.    if(buttonsEnabled)
  12.    {
  13.       playButtonInst.enabled = false;
  14.       instructButtonInst.enabled = false;
  15.       hiscoresButtonInst.enabled = false;
  16.       sendButtonInst.enabled = false;
  17.       buttonsEnabled = false;
  18.    }
  19.    else
  20.    {
  21.       playButtonInst.enabled = true;
  22.       instructButtonInst.enabled = true;
  23.       hiscoresButtonInst.enabled = true;
  24.       sendButtonInst.enabled = true;
  25.       buttonsEnabled = true;
  26.    }
  27. }
  28. function startDemo()
  29. {
  30.    _global.sfxTitleMusic.stop();
  31.    gameMode = MODE_PLAYDEMO;
  32.    gotoAndStop("Game Running");
  33.    play();
  34. }
  35. stop();
  36. _quality = "HIGH";
  37. StrTable.populate();
  38. if(sysInfoSent != true)
  39. {
  40.    StatsTrackerInst.SendGameLaunched(3);
  41.    StatsTrackerInst.SendSystemInfo(3);
  42.    sysInfoSent = true;
  43. }
  44. TimerInst.Reset();
  45. TimerInst.Start();
  46. MODE_PLAYGAME = 0;
  47. MODE_PLAYDEMO = 1;
  48. MODE_RECORDDEMO = 2;
  49. gameMode = MODE_PLAYGAME;
  50. var mouseListener = new Object();
  51. var i = 0;
  52. while(i < 11)
  53. {
  54.    this["bullet" + i]._visible = false;
  55.    i++;
  56. }
  57. mouseListener.onMouseMove = function()
  58. {
  59.    TimerInst.Reset();
  60.    TimerInst.Start();
  61. };
  62. Mouse.addListener(mouseListener);
  63. buttonsEnabled = true;
  64. scoreMode = 0;
  65. sendToFriendMode = 0;
  66. instructionsBoxInst._visible = false;
  67. sendBoxInst._visible = false;
  68. _global.sfxUI = new Sound(createEmptyMovieClip(sfxUIclip,500));
  69. _global.sfxUI.attachSound("uiclick");
  70. _global.sfxUnFreeze = new Sound(createEmptyMovieClip(sfxUnFreeze,504));
  71. _global.sfxUnFreeze.attachSound("baddiewakeup.wav");
  72. _global.sfxFreeze = new Sound(createEmptyMovieClip(sfxFreeze,505));
  73. _global.sfxFreeze.attachSound("turntoice.wav");
  74. _global.sfxFireGun = new Sound(createEmptyMovieClip(sfxFireGun,506));
  75. _global.sfxFireGun.attachSound("heat.wav");
  76. _global.sfxIceGun = new Sound(createEmptyMovieClip(sfxIceGun,507));
  77. _global.sfxIceGun.attachSound("ice.wav");
  78. _global.sfxSprayGun = new Sound(createEmptyMovieClip(sfxSprayGun,508));
  79. _global.sfxSprayGun.attachSound("spray.wav");
  80. _global.sfxCollectGood = new Sound(createEmptyMovieClip(sfxCollectGood,509));
  81. _global.sfxCollectGood.attachSound("collectgood.wav");
  82. _global.sfxCollectBad = new Sound(createEmptyMovieClip(sfxCollectBad,510));
  83. _global.sfxCollectBad.attachSound("collectbad.wav");
  84. _global.sfxHurt = new Sound(createEmptyMovieClip(sfxHurt,511));
  85. _global.sfxHurt.attachSound("hurt.wav");
  86. _global.sfxSpawn = new Sound(createEmptyMovieClip(sfxSpawn,512));
  87. _global.sfxSpawn.attachSound("spawn.wav");
  88. _global.sfxThud = new Sound(createEmptyMovieClip(sfxThud,513));
  89. _global.sfxThud.attachSound("thud.wav");
  90. _global.sfxTitleMusic = new Sound(createEmptyMovieClip(sfxTitleMusic,501));
  91. _global.sfxTitleMusic.attachSound("kitchenofdoomtitle01.wav");
  92. _global.sfxWinMusic = new Sound(createEmptyMovieClip(sfxWinMusic,502));
  93. _global.sfxWinMusic.attachSound("kitchenofdoomwin01.wav");
  94. _global.sfxIngameMusic = new Sound(createEmptyMovieClip(sfxIngameMusic,503));
  95. _global.sfxIngameMusic.attachSound("kitchenofdoom_ingame01.wav");
  96. _global.sfxTitleMusic.start(0,9999);
  97. playButtonInst.onRelease = function()
  98. {
  99.    _global.sfxTitleMusic.stop();
  100.    _global.sfxUI.start();
  101.    gotoAndStop("Game Running");
  102.    play();
  103. };
  104. instructButtonInst.onRelease = function()
  105. {
  106.    _global.sfxUI.start();
  107.    toggleButtons();
  108.    instructionsBoxInst._visible = true;
  109.    instructionsBoxInst.gotoAndStop(1);
  110.    instructionsBoxInst.instAnim.gotoAndPlay(1);
  111. };
  112. hiscoresButtonInst.onRelease = function()
  113. {
  114.    _global.sfxUI.start();
  115.    toggleButtons();
  116.    gotoAndStop("Hiscores");
  117.    play();
  118. };
  119. sendButtonInst.onRelease = function()
  120. {
  121.    _global.sfxUI.start();
  122.    toggleButtons();
  123.    sendBoxInst._visible = true;
  124.    sendBoxInst.name.text = "";
  125.    sendBoxInst.email.text = "";
  126.    Selection.setFocus(sendBoxInst.name);
  127. };
  128. onEnterFrame = function()
  129. {
  130.    if(TimerInst.getTime() > 10000)
  131.    {
  132.       if(instructionsBoxInst._visible == false && sendBoxInst._visible == false)
  133.       {
  134.          startDemo();
  135.       }
  136.       else
  137.       {
  138.          TimerInst.Reset();
  139.          TimerInst.Start();
  140.       }
  141.    }
  142. };
  143.